{% extends 'layout.html' %}

{% block head %}
<link rel="stylesheet" href="/blog/static/css/dashboard/post.css" type="text/css">
{% endblock %}

{% block foot %}
<script src="/blog/static/js/dashboard/post_list.js" type="text/javascript"></script>
{% endblock %}

{% block content %}
	{% include 'bread.html'%}
	<div class="view-content">
	<div class="view-content-container">
		<table class="table table-striped table-condensed">
	      <thead>
	        <tr>
	          <th>id</th>
	          <th>标题</th>
	          <th>作者</th>
	          <th>分类</th>
	          <th>操作</th>
	        </tr>
	      </thead>
	      <tbody id="postListBody">
	      	{% for post in posts%}
	      	{% set cate = siteInfo.cates_item[post.category] || {} %}
	        <tr>
	          <th scope="row">{{ post.id }}</th>
	          <td><a href="/post/content/{{ post.id }}" target="_blank">{{ post.title }}</a></td>
	          <td>{{ post.author }}</td>
	          <td>{{ cate.name }}</td>
	          <td><a href="/dashboard/post/edit?id={{ post.id }}">编辑</a><span> | </span><a href="#" data-id="{{ post.id }}" class="delete">删除</a></td>
	        </tr>
	      	{% endfor %}
	      </tbody>
	    </table>

	  {% if !posts || posts.length == 0%}
	  <div class="post-none">
	    <p>没有对应文章！</p>
	  </div>
	  {% else %}
	  	{% include 'page.html'%}
	  {% endif %}
	</div>
	</div>
{% endblock %}
